<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Spry Textarea Validation API</title>
<link href="../../../css/articles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="accordion">
  <h3>Password Validation Widget</h3>
  <h4>Description</h4>
  <p>The Spry Password Validation Widget is used to validate a password text field, verifying the strength of the password. </p>
  <h4>Required Files</h4>
  <blockquote>
    <p><a href="../../../widgets/passwordvalidation/SpryValidationPassword.js">SpryValidationPassword.js</a></p>
    <p><a href="../../../widgets/passwordvalidation/SpryValidationPassword.css">SpryValidationPassword.css</a></p>
  </blockquote>
  <h4>Reference File</h4>
  <blockquote>
    <p><a href="../../../widgets/passwordvalidation/SpryValidationPassword.html">SpryValidationPassword.html</a></p>
  </blockquote>
  <h4>Sample Files</h4>
  <blockquote>
    <p><a href="../../../samples/validationwidgets/PasswordValidationSample.html">PasswordValidationSample.html</a></p>
  </blockquote>
  </div>

<div id="structure"><h3> Structure</h3>
  <p>The widget structure is as follows:</p>
  <pre>
   &lt;widget container&gt;
      &lt;input password&gt;<br />      &lt;message container(s)&gt;<br />   &lt;/widget container&gt;<br /></pre>
  <p>The Password Validation Widget supports one password field per widget.</p>
      <p>The markup used in this structure can be most any HTML, as long as it follows the rules for nesting. </p>
      <p>Using the provided files, the default mark up is:</p>
			<pre> &lt;span id=&quot;sprypassword1&quot;&gt;<br />	&lt;input type=&quot;password&quot; name=&quot;password1&quot; id=&quot;password1&quot; /&gt;<br /> 	&lt;span class=&quot;passwordRequiredMsg&quot;&gt;A value is required.&lt;/span&gt;<br />	&lt;span class=&quot;passwordMinCharsMsg&quot;&gt;The minimum number of characters not met.&lt;/span&gt;<br />	&lt;span class=&quot;passwordMaxCharsMsg&quot;&gt;The maximum number of characters exceeded.&lt;/span&gt;<br /> 	&lt;span class=&quot;passwordInvalidStrengthMsg&quot;&gt;The password strength condition not met.&lt;/span&gt;<br />	&lt;span class=&quot;passwordCustomMsg&quot;&gt;User defined condition not met.&lt;/span&gt;<br />&lt;/span&gt;</pre>
      <p>The type and number of error messages will depend on the developer's needs.</p>
</div>

<div id="constructor"><h3>Constructor</h3>
  <p>Widget Constructors are small pieces of javascript that activate the markup into the working widget. These scripts must come AFTER the markup on the page, since the markup needs to exist before the constructor fires.</p>
  <pre>&lt;script type=&quot;text/javascript&quot;&gt;<br />&lt;!--<br />	var sprypassword1 = new Spry.Widget.ValidationPassword(&quot;sprypassword1&quot;);<br />//--&gt;<br />&lt;/script&gt;</pre>
  <h4>Basic Constructor</h4>
  <p>A basic constructor specifies the name of the widget and identifies the ID of the main markup container. The name of the widget is used to identify the widget for functions and methods.</p>
  <pre>&lt;script type=&quot;text/javascript&quot;&gt; 
	var <span class="hilite">widgetname</span> = new Spry.Widget.ValidationPassword(&quot;<span class="hilite">id of widget container</span>&quot;);   
&lt;/script&gt;
</pre>
  <h4>Constructor Options</h4>
  <p>Constructor options allow users to specify certain attributes of the widget.</p>
  <p>Constructor options follow the ID parameter, wrapped in curly braces {}. Options are name:value pairs, separated by a colon (:). </p>
  <pre> &lt;script type=&quot;text/javascript&quot;&gt; 
   var widgetname = new Spry.Widget.ValidationPassword(&quot;id of widget container&quot;<span class="hilite">,{option1:value, option2:value, option3:&quot;value&quot;}</span>);   
 &lt;/script&gt;
  </pre>
  <table >
    <tr>
      <th><a name="options" id="options"></a>Option</th>
      <th>Type</th>
      <th>Default</th>
      <th>Description</th>
    </tr>
    <tr>
      <td>isRequired</td>
      <td>Boolean</td>
      <td>false</td>
      <td>Determines if the field is required to have a value.</td>
    </tr>
    <tr>
      <td>minChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>The minimum number of characters required for a valid password.</td>
    </tr>
    <tr>
      <td>maxChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>The maximum allowable length of the password.</td>
    </tr>
    <tr>
      <td>minAlphaChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>Minimum number of letters required for a password to be valid.</td>
    </tr>
    <tr>
      <td>maxAlphaChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>Maximum number of letters required for a password to be valid.</td>
    </tr>
    <tr>
      <td>minUpperAlphaChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>Minimum number of upper case letters required for a password to be valid.</td>
    </tr>
    <tr>
      <td>maxUpperAlphaChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>Maximum number of upper case letters required for a password to be valid.</td>
    </tr>
    <tr>
      <td>minSpecialChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>Minimum number of special characters required for a password to be valid.</td>
    </tr>
    <tr>
      <td>maxSpecialChars</td>
      <td>number/string</td>
      <td>none</td>
      <td>Maximum number of special characters required for a password to be valid.</td>
    </tr>
    <tr>
      <td>minNumbers</td>
      <td>number/string</td>
      <td>none</td>
      <td>Minimum number of numbers required for a password to be valid.</td>
    </tr>
    <tr>
      <td>maxNumbers</td>
      <td>number/string</td>
      <td>none</td>
      <td>Maximum number of numbers required for a password to be valid.</td>
    </tr>
    <tr>
      <td>additionalError</td>
      <td>string</td>
      <td>none</td>
      <td>The id of an element in the page where the classes that applies to the main container also are added.</td>
    </tr>
    <tr>
      <td>focusClass</td>
      <td>string</td>
      <td>passwordFocusState</td>
      <td>Custom CSS class to use for the focus state. Replaces the default .passwordFocusState class.</td>
    </tr>
    <tr>
      <td>requiredClass</td>
      <td>string</td>
      <td>passwordRequiredState</td>
      <td>Custom CSS class to use for the required state. Replaces the default .passwordRequiredState class.</td>
    </tr>
    <tr>
      <td>invalidCharsMinClass</td>
      <td>string</td>
      <td>passwordMinCharsState</td>
      <td>Custom CSS class to use for the invalidCharsMin state. Replaces the default .passwordMinCharsState class.</td>
    </tr>
    <tr>
      <td>invalidCharsMaxClass</td>
      <td>string</td>
      <td>passwordMaxCharsState</td>
      <td>Custom CSS class to use for the invalidCharsMax state. Replaces the default .passwordMaxCharsState class.</td>
    </tr>
    <tr>
      <td>invalidStrengthClass</td>
      <td>string</td>
      <td>passwordInvalidStrengthState</td>
      <td>Custom CSS class to use for the InvalidStrengthState state. Replaces the default .passwordInvalidStrengthState class.</td>
    </tr>
    <tr>
      <td>validClass</td>
      <td>string</td>
      <td>passwordValidState</td>
      <td>Custom CSS class to use for the valid state. Replaces the default .passwordValidState class.</td>
    </tr>
    <tr>
      <td>validateOn</td>
      <td>string</td>
      <td>onSubmit</td>
      <td>Determines what event will cause the field to be validated. It always checks onSubmit. Other values are 'blur' and 'change'.</td>
    </tr>
  </table>
  <pre> &lt;script type=&quot;text/javascript&quot;&gt;
  &nbsp;&nbsp;&nbsp;&nbsp;var PasswordWidgetObject  = new Spry.Widget.ValidationPassword(&quot;PasswordWidget&quot;, {maxChars:8, validateOn:[&quot;blur&quot;, &quot;change&quot;], focusClass:&quot;myfocus&quot;});
 &lt;/script&gt;</pre>
  <p>Recall that javascript is case sensitive.</p>
</div>
<div id="methods">
  <h2>Password Validation Widget Methods</h2>
  <div id="reset">
    <h3><strong>reset</strong></h3>
    <p>Reset the widget to its original state.</p>
    <h4>Format</h4>
    <p>widgetName.reset();</p>
    <h4>Example</h4>
    <pre> &lt;a href=&quot;#&quot; onclick=&quot;PasswordWidgetObject.reset(); return false;&quot;&gt;Reset Password&lt;/a&gt; </pre>
  </div>
  <div id="validate">
    <h3><strong>validate</strong></h3>
    <p>Validates the current state of the widget.</p>
    <h4>Format</h4>
    <p>widgetName.validate();</p>
    <h4>Example</h4>
    <pre>&lt;a href=&quot;#&quot; onclick=&quot;PasswordWidgetObject.validate(); return false;&quot;&gt;Validate Password&lt;/a&gt;</pre>
  </div>
</div>
<hr /><p>Copyright © 2007. Adobe Systems Incorporated. <br />
All rights reserved.</p></body>
</html>
